package com.sailors.common.task.provider.infra.design.common.rest;

import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;

@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Accessors(chain = true)
@Setter
@Getter
@NoArgsConstructor
public class BaseResponse<T> extends Response implements Serializable {
    private static final long serialVersionUID = -4355059008534866644L;
    protected T dataInfo;

    public BaseResponse(T dataInfo, int code, String message) {
        super(code, message, null);
        this.dataInfo = dataInfo;
    }

    /**
     * 是否为成功响应
     */
    public boolean success() {
        return this.returnCode.equals(ReturnCode.SUCCESS.getCode());
    }
}
